package ua.net.gm.common.matter;

import ua.net.gm.common.entity.EntityDict;
import ua.net.gm.common.entity.EntityId;
import ua.net.gm.common.entity.EntitySupport;
import ua.net.gm.common.entity.EntityType;
import ua.net.gm.common.entity.IEntityDict;
import ua.net.gm.common.entity.IEntityDictFactory;

/**
 *
 * @author syar
 */
public class MatterId extends EntityId
{
    public static final String ID = "matter";

    MatterId(EntitySupport entitySupport, EntityType entityType)
    {
        super(entitySupport,
                entityType != null ? entityType
                        : entitySupport.createType(ID, new MatterIdDictFactory()));
    }

    public static void init(EntitySupport entitySupport)
    {
        entitySupport.createType(ID, new MatterIdDictFactory());
    }

    private static class MatterIdDictFactory implements IEntityDictFactory<MatterId>
    {

        @Override
        public IEntityDict<MatterId> create(final EntitySupport entitySupport, final EntityType entityType)
        {
            return new EntityDict<MatterId>()
            {
                @Override
                protected MatterId createId()
                {
                    return new MatterId(entitySupport, entityType);
                }
            };
        }
    }
}
